<?php

namespace Application\model;

use Cola\Model;

class ConfigModel extends Model
{
    /**
     * 通过key获取配置信息
     * @param $key
     * @param $returnValue
     * @return array|mixed
     */
    public function getInfoByKey($key, $returnValue = '')
    {
        $sql = "select * from cfg_game where `key` = '$key'";
        $row = $this->db->row($sql);
        if ($row && $returnValue) return $row[$returnValue];
        return $row;
    }

    /**
     * 通过id获取物品信息
     * @param $id
     * @return array
     */
    public function getItemById($id)
    {
        $sql = "select * from cfg_item where `id` = '$id'";
        $row = $this->db('_backdb')->row($sql);
        return $row;
    }

}